package com.vivz.baby.service;

import android.os.Bundle;
import android.os.Handler;
import android.os.ResultReceiver;
import android.util.Log;

public class LogServiceReceiver extends ResultReceiver {

	private static final String TAG = "LogServiceReceiver";
	private Listener listener;

	public LogServiceReceiver(Handler handler) {
		super(handler);
	}

	public void setListener(Listener listener) {
		this.listener = listener;
	}

	@Override
	protected void onReceiveResult(int resultCode, Bundle resultData) {
		if (listener == null) {
			Log.e(TAG, "listener is not set !");
		} else {
			listener.onReceiveResult(resultCode, resultData);
		}
	}

	public static interface Listener {
		void onReceiveResult(int resultCode, Bundle resultData);
	}

}
